<template>
  <a-modal
    title="审批类型选择"
    :visible="visible"
    class="pub-middle-dialog"
    @ok="handleOk"
    @cancel="visible=false"
  >
    <a-form-model
      ref="ruleForm"
      :model="formData"
      :rules="rules"
      class="about-master-container"
    >
      <a-form-model-item label="审批类型">
        <a-select v-model="formData.type">
          <a-select-option value="1">
            非工程实体类
          </a-select-option>
          <a-select-option value="2">
            工程实体类
          </a-select-option>
          <a-select-option value="3">
            变更
          </a-select-option>
        </a-select>
      </a-form-model-item>
    </a-form-model>
  </a-modal>
</template>
<script>
    export default {
	name:'a'+Date.now(),
        data:function () {
            return{
                visible:false,
                formData:{
                    type:''
                },
                rules:{
                    type:{required: true, message: '审批类型不能为空', trigger: 'change'},
                }
            }
        },
        methods:{
            open:function () {
                this.visible = true;
            },
            handleOk:function () {
                this.$refs.ruleForm.validate((valid,object) => {
                    if (valid) {
                        this.$emit('submit',this.formData.type);
                        this.visible = false;
                    } else {                  
                        return false;
                    }
                });
            }
        }
    }
</script>